# -*- encoding=utf-8 -*-
# 1、使用14号电机和5号脉冲（SG90舵机）

from froModuleDrivers.generalDeviceDriver import GeneralDeviceDriver
from froModuleDrivers.nioManager import NioManager
import time
from froModuleDrivers import LOGGER


# LOGGER.set_lvl("debug")

driver = GeneralDeviceDriver("192.168.50.110", 4001)
manager = NioManager(driver)
manager.run()

driver.showVersion()

driver.setMotorCounterclockwiseTime(14, 50, 1.8) # 电梯以50%的速度下降1.8秒
time.sleep(2.5)
driver.setMotorClockwiseTime(14, 50, 2.5) # 电梯以50%的速度上升2.5秒
time.sleep(2.5)
driver.setServoAngle(5,90) # 控制舵机角度
time.sleep(1)

manager.shutdownGracefully() # 等待指令执行完毕后系统退出
